package com.yy.satokenapplication.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yy.satokenapplication.entity.SysUser;
import com.yy.satokenapplication.service.SysUserService;
import com.yy.satokenapplication.mapper.SysUserMapper;
import com.yy.satokenapplication.util.PasswordEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author young
* @description 针对表【sys_user(系统用户表)】的数据库操作Service实现
* @createDate 2025-03-16 16:30:47
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
    implements SysUserService{
    
    @Autowired
    private PasswordEncryptor passwordEncryptor;
    
    public SysUser getUserByUsername(String username) {
        return getOne(new LambdaQueryWrapper<SysUser>()
                .eq(SysUser::getUsername, username));
    }

    public boolean checkPassword(String password, String password1) {
        return passwordEncryptor.verifyPassword(password, password1);
    }
    
}




